package com.trust.entity.Param;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author ccc
 * @desc
 * @since 2023/11/20 15:08
 */
@Data
@ApiModel("分页入参")
public class PageParam implements Serializable {

    private static final Integer PAGE_NUM = 1;

    private static final Integer PAGE_SIZE = 15;

    @ApiModelProperty(value = "页码", allowEmptyValue = true)
    private Integer pageNum;
    @ApiModelProperty(value = "条数", allowEmptyValue = true)
    private Integer pageSize;
    @ApiModelProperty(value = "关键词", allowEmptyValue = true)
    private String keywords;

    public PageParam(Integer pageNum, Integer pageSize, String keywords) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.keywords = keywords;
    }

    public PageParam() {
        this.pageNum = this.pageNum == null ? PAGE_NUM : this.pageNum;
        this.pageSize = this.pageSize == null ? PAGE_SIZE : this.pageSize;
    }
}
